package spec.dengyuru.animal;

//通过abstract关键词声明抽象类
public abstract class Animal {
    //成员属性        private String name;
        private String food;
        private String ared;
        //封装
        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getFood() {
            return food;
        }

        public void setFood(String food) {
            this.food = food;
        }

        public String getAred() {
            return ared;
        }

        public void setAred(String ared) {
            this.ared = ared;
        }
        //构造方法
        //默认构造方法,无参数
        public Animal(){
        }
        //自定义构造方法，有参数
        public  Animal(String name,String food,String ared){
            this.name=name;
            this.food=food;
            this.ared=ared;
        }
        //成员方法
        //抽象方法没有方法体
        abstract String findfood();
        //普通方法有方法体
        public String eat(){
            return this.name+"吃"+this.food;
        }
        abstract String wholeLife();
    }



